<!DOCTYPE html>

<html>

    <head>


        <title>Mon Blog</title>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">


        <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">

        <script src="js/jquery-2.1.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>


        <script src="js/jquery-2.1.0.min.js"></script>
        <link rel="stylesheet" href="inc/css/bootstrap/css/bootstrap.min.css" type="text/css">
        <link rel="stylesheet" href="inc/css/bootstrap/css/bootstrap-theme.min.css" type="text/css">
        <script src="inc/css/bootstrap/js/bootstrap.min.js"></script>
        <link rel="stylesheet" href='inc/css/bootstrap/css/moncss.css' type='text/javascript'>
        <style type="text/css">
            .div_666 {
                width:500px; 
                margin-left:auto; 
                margin-right :auto;
            }
        </style>
    </head>
    <body>

    <body>

        <!--MISE EN PLACE DE LA NAVBAR-->

        <nav class="navbar navbar-inverse" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">

                    <a class="navbar-brand" href="?composant=articles&action=listing"> <span class="glyphicon glyphicon-home"></span></a>
                </div>

                MISE EN PLACE DE L'ONGLET UTILISATEUR + OPTION

                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Pseudo Utilisateur <span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="#">Deconnexion</a></li>
                            <li class="divider"></li>
                            <li><a href="#">Pannel D'administration</a></li>
                        </ul>
                    </li>
                </ul>
            </div>

        </nav>


        <!--AIGUILLEUR-->
        <?php
        require_once 'inc/config.php';



        $composant = isset($_GET["composant"]) ? $_GET["composant"] : "";
        $action = isset($_GET["action"]) ? $_GET["action"] : "";

        // AUTOLOAD

        function chargerComposantControleur($composantControleur) {
            require "composants/" . $composantControleur . "/" . $composantControleur . "_controleur.php";
        }

        spl_autoload_register("chargerComposantControleur");




        // AIGUILLEUR LISTING ARTICLES

        if ($composant == "articles") {

            $controleur = new articles();
            if ($action == "listing") {
                $controleur->afficherDonneesArticle();
            } elseif ($action == "modifier") {
                $idArticle = isset($_GET["idArticle"]) ? $_GET["idArticle"] : "";
                $controleur->ModifierDonneesArticle($idArticle);
            } elseif ($action == "update") {
                $idArticle = isset($_GET["idArticle"]) ? $_GET["idArticle"] : "";
            } elseif ($action == "modifier") {
                $idArticle = isset($_GET["idArticle"]) ? $_GET["idArticle"] : "";
                $controleur->ModifierDonneesArticle($idArticle);
            } elseif ($action == "update") {
                $idArticle = isset($_GET["idArticle"]) ? $_GET["idArticle"] : "";

                $controleur->UpdateDonneesArticle($idArticle);
            }
            $controleur->UpdateDonneesArticle($idArticle);
        }
        // AIGUILLEUR SUPPRESSION ARTICLES

        if ($composant == "articles") {

            if ($action == "delete") {
                $idArticle = isset($_GET["idArticle"]) ? $_GET["idArticle"] : "";
                $controleur->effacerDonneesArticle($idArticle);
            }
        }





        // AIGUILLEUR LISTING UTILISATEURS


        if ($composant == "utilisateurs") {

            $controleur = new utilisateurs();
            if ($action == "listing") {
                $controleur->afficherDonneesUtilisateur();
            }
        }
        ?>
    </body>
</html>
